<!DOCTYPE html>
<html lang="en">
<head>
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width,height=device-height">
  <meta charset="UTF-8">
  <meta name="Author" content="haley">
  <meta name="Keywords" content="数组乱序,打乱顺序">
  <meta name="Description" content="最常用的UI插件">
  <script crossorigin="anonymous" integrity="sha384-6ePHh72Rl3hKio4HiJ841psfsRJveeS+aLoaEf3BWfS+gTF0XdAqku2ka8VddikM" src="https://lib.baomitu.com/jquery/1.11.3/jquery.min.js"></script>
  <link crossorigin="anonymous" integrity="sha384-pdapHxIh7EYuwy6K7iE41uXVxGCXY0sAjBzaElYGJUrzwodck3Lx6IE2lA0rFREo" href="https://lib.baomitu.com/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
  <link href="../../../css/page.css" rel="stylesheet">
  <script crossorigin="anonymous" integrity="sha384-pPttEvTHTuUJ9L2kCoMnNqCRcaMPMVMsWVO+RLaaaYDmfSP5//dP6eKRusbPcqhZ" src="https://lib.baomitu.com/twitter-bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <script crossorigin="anonymous" integrity="sha384-8t+aLluUVnn5SPPG/NbeZCH6TWIvaXIm/gDbutRvtEeElzxxWaZN+G/ZIEdI/f+y" src="https://lib.baomitu.com/vue/2.6.10/vue.min.js"></script>
  <script src="../../../js/page.js"></script>
  <script src="../../../js/changeTitle.js"></script>
  <link href="../../../imgs/favicon.ico" rel="shortcut icon">
  <script src="../../../js/goToHome.js"></script>
  <title></title>
  <script>
    var data={
      title:'日期时间相关',
      content:{
        intro:{
          list:[
            {
              title:'使用说明：',
              className:'bs-callout-info',
              list:[
                {title:'基础配置：',content:'无'}
                ,{title:'如何使用：',content:'直接复制本文件js源码'}
              ]
            }
          ]
        }
      }
    };
  </script>
</head>
<body>
<div id="page">
  <div class="container">
    <h3 class="text-center">{{title}}</h3>
    <div class="bs-callout" :class="item.className" v-for="item in content.intro.list">
      <h4>{{item.title}}</h4>
      <ul>
        <li v-for="item2 in item.list"><b>{{item2.title}}</b>{{item2.content}}</li>
      </ul>
    </div>
  </div>
  <script>
    var page = new Vue({
      el: '#page',
      data: data
    });
  </script>
</div>

<div class="container">
  <section class="panel panel-info">
    <div class="panel-heading">中文月日转为英文</div>
    <div class="panel-body">
      <!--核心代码 s-->
      <div class="row">
        <div class="col-sm-12">
          <div class="">
            <p>
<pre>
  function getMonthDayEn(str){
     var data={
       monthEn:["Jan.","Feb.","Mar.","Apr.","May.","June","July","Aug.","Sept","Oct.","Nov.","Dec."],
       dateEn:["st","nd","rd","th"]
     };
     var month=str.split('月')[0]-1;
     var date=str.split('月')[1].split('日')[0];
     if(data<4){
       date=date+data.dateEn[date];
     }else{
       date=date+data.dateEn[3];
     }
     return {
       month:data.monthEn[month],
       date:date
     }
  }
  console.log(getMonthDayEn('6月4日')); //{month: "June", date: "4th"}
</pre>
            </p>
          </div>
          <!--核心js-->
          <script>
            function getMonthDayEn(str){
              var data={
                monthEn:["Jan.","Feb.","Mar.","Apr.","May.","June","July","Aug.","Sept","Oct.","Nov.","Dec."],
                dateEn:["st","nd","rd","th"]
              };
              var month=str.split('月')[0]-1;
              var date=str.split('月')[1].split('日')[0];
              if(data<4){
                date=date+data.dateEn[date];
              }else{
                date=date+data.dateEn[3];
              }
              return {
                month:data.monthEn[month],
                date:date
              }
            }
            console.log(getMonthDayEn('6月4日')); //{month: "June", date: "4th"}
          </script>
          <!--核心js-->
        </div>
      </div>
      <!--核心代码 e-->
    </div>
  </section>
</div>

</body>

</html>
